package org.java;

import java.io.IOException;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;


public class Base64Test {
	

	public static void main(String[] args) throws IOException {
		
		//向OutPutStream中写入，如 message.writeTo(baos);  
		String src = "你好";
		BASE64Encoder base64Encoder = new BASE64Encoder();
		BASE64Decoder base64Decoder = new BASE64Decoder();
		String encode = base64Encoder.encode(src.getBytes());
		System.out.println(encode);
		byte[] decodeBuffer = base64Decoder.decodeBuffer(encode);
		System.out.println(new String(decodeBuffer));
		
		
	}
}
